/* eslint-disable no-unused-vars */
import React, { useEffect, useState } from "react";
import styles from './tcuser.module.css'
import Space from "@/pages/components/space/space";
import Card from "@/pages/components/card/card";
import LineRow from "@/pages/components/line/lineRow";
import Paragraph from "@/pages/components/paragraph/paragraph";
import Title from "@/pages/components/paragraph/title";
import Text from "@/pages/components/paragraph/text";
import Table from "@/pages/components/table/table";
import FlexRow from "@/pages/components/flexLayout/flexRow";
import SubmitButton from "@/pages/components/submitButton/submitButton";

export default function TcUserLayout() {

    const [isLoading, setIsLoading] = useState(false);

    const headerList = [
        { title: 'Product', dataIndex: 'product' },
        { title: 'Mobile', dataIndex: 'mobile' },
        { title: 'User ID', dataIndex: 'user_id' },
        { title: 'Token', dataIndex: 'token' },
        { title: 'Name', dataIndex: 'name' },
        { title: 'Android ID', dataIndex: 'android_id' },
        { title: 'Advert ID', dataIndex: 'advert_id' },
        { title: 'Channel Code', dataIndex: 'channel_code' },
        { title: 'Create Time', dataIndex: 'create_time' }
    ];

    const dataList = [
        { product: 'x', mobile: '0545738115', user_id: 'xxx', token: 'xxx', name: 'xxx', android_id: 'xxx', advert_id: 'xxx', channel_code: 'xxx', create_time: 'xxx' },
        { product: 'x', mobile: '0545738115', user_id: 'xxx', token: 'xxx', name: 'xxx', android_id: 'xxx', advert_id: 'xxx', channel_code: 'xxx', create_time: 'xxx' },
        { product: 'x', mobile: '0545738115', user_id: 'xxx', token: 'xxx', name: 'xxx', android_id: 'xxx', advert_id: 'xxx', channel_code: 'xxx', create_time: 'xxx' },
        { product: 'x', mobile: '0545738115', user_id: 'xxx', token: 'xxx', name: 'xxx', android_id: 'xxx', advert_id: 'xxx', channel_code: 'xxx', create_time: 'xxx' },
        { product: 'x', mobile: '0545738115', user_id: 'xxx', token: 'xxx', name: 'xxx', android_id: 'xxx', advert_id: 'xxx', channel_code: 'xxx', create_time: 'xxx' },
    ];

    useEffect(() => {
        return () => {
        }
    }, [])

    const onHandleCopy = () => {
        // TODO: 实现复制功能
    }

    const onHandleRefresh = async () => {
        setIsLoading(true);
        try {
            // TODO: 实现刷新逻辑
            await new Promise(resolve => setTimeout(resolve, 5000)); // 模拟加载
        } finally {
            setIsLoading(false);
        }
    }

    const hotlineConfig = { "afKey": "", "mobile": "0545738115", "email": "Ozzyggjsevice@outlook.com", "company": "OZZYMONEY", "hostForLogo": "https://www.ozzymoney.info", "walletChannels": [{ "desc": "Airtel", "value": "AIRTEL", "logo": "https://www.creditcorner.top/AIRTELKNY.png" }, { "desc": "Vodacom", "value": "VODACOM", "logo": "https://www.creditcorner.top/VODACOM.png" }, { "desc": "Orange Money", "value": "ORANGE", "logo": "https://www.creditcorner.top/ORANGE.png" }], "phoneHint": "NO", "companyAddress": "71 Av Lusambo, Mbuji-Mayi, République démocratique du Congo", "homeAmount": "200000", "showSysReview": "YES", "oneKeyRepayType": "", "repayType": "REPAYPAGE", "repayChannel": ["WAVE", "ORANGE", "MTN", "MOOV"], "rejectPeriod": "30", "permissions": { "permission": ["android.permission.READ_SMS"], "home": ["android.permission.READ_SMS"], "permissionGp": ["android.permission.READ_SMS"] }, "accList": [{ "accM": "0516123458", "accTk": "84aab19a0a2d800b40b6d45cce68f75d" }], "repayAttentin": "Attention : Il ne s'agit pas d'un compte de remboursement, veuillez ne pas effectuer de transaction sur ce numéro. Pour les remboursements, veuillez effectuer votre remboursement en ligne via l'APP.", "repayImportant": "RAPPEL IMPORTANT : Cette plateforme ne prend en charge que les remboursements effectués en ligne via cette APP. Toute autre forme de remboursement par virement n'est pas valable.", "transferDelayImportant": "Indice important : Après l'approbation de votre prêt, vous recevrez généralement le transfert de prêt dans les 24 heures. Veuillez prêter attention aux rappels SMS pertinents.\nEn raison de la coopération des opérateurs de paiement (Wave/orange money/MTN/MOOV), le délai de transfert de votre prêt vers vous peut être retardé. Veuillez patienter ou contacter le service client pour plus d'informations." };
    const hotlineConfigJson = JSON.stringify(hotlineConfig, null, 4);

    return (
        <div className={styles.tcAppShowRoot}>
            <Card title="用户信息" style={{ width: '100%' }}>

                <Table
                    headerList={headerList}
                    dataList={dataList}
                    loading={isLoading}
                    onRowClick={(row, index) => {
                        console.log('点击行:', row, index);
                    }}
                />

                {/* 提交区域 */}
                <FlexRow style={{ marginTop: '32px', marginLeft: '2px' }}>
                    <SubmitButton label="刷新" onClick={() => { onHandleRefresh() }} />
                </FlexRow>

                <Space size="24px" />

                <LineRow />
                <Space size="16px" />

                <Paragraph>
                    <Title>说明</Title>
                    <Text>请复制对应的配置到本地修改, 然后再发给后端更新</Text>
                </Paragraph>
            </Card>
        </div>
    )
}